﻿namespace ClassLibrary.BusinessLayer.Facade
{
    using ClassLibrary.BusinessLayer.BusinessObjects;
    using ClassLibrary.DataLayer.DataObjects;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Data.Common;

    [DataObject(true)]
    public class ProductFacade
    {
        private IProductDAO productDAO = DAOAccess.ProductDAO;

        [DataObjectMethod(DataObjectMethodType.Insert)]
        public bool AddProduct(Product clsProduct)
        {
            return this.productDAO.InsertProduct(clsProduct);
        }

        [DataObjectMethod(DataObjectMethodType.Insert)]
        public int AddProductAndReturnIdentity(Product clsProduct)
        {
            return this.productDAO.InsertProductReturnIdentity(clsProduct);
        }

        [DataObjectMethod(DataObjectMethodType.Insert)]
        public string AddProductAndReturnOutput(Product clsProduct)
        {
            return this.productDAO.InsertProductReturnOutput(clsProduct);
        }

        [DataObjectMethod(DataObjectMethodType.Delete)]
        public bool DeleteProduct(Product clsProduct)
        {
            return this.productDAO.DeleteProduct(clsProduct);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public IList<Product> GetProduct(Product clsProduct)
        {
            return this.productDAO.GetProduct(clsProduct);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public IList<Product> GetProduct(string product)
        {
            Product clsProduct = new Product();
            clsProduct.Model = product;
            return this.productDAO.GetProduct(clsProduct);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public IList<Product> GetsProduct()
        {
            return this.productDAO.GetsProduct();
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public DataTable GetsProduct(string SPName, DbParameter[] param)
        {
            return this.productDAO.GetsProduct(SPName, param);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public IList<Product> ListProduct(Product clsProduct)
        {
            return this.productDAO.ListProduct(clsProduct);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public IList<Product> ListProduct(string product)
        {
            Product clsProduct = new Product();
            clsProduct.Model = product;
            return this.productDAO.ListProduct(clsProduct);
        }

        [DataObjectMethod(DataObjectMethodType.Update)]
        public bool UpdateProduct(Product clsProduct)
        {
            return this.productDAO.UpdateProduct(clsProduct);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public int UpdateProduct(string SPName, DbParameter[] param)
        {
            return this.productDAO.UpdateProduct(SPName, param);
        }
    }
}

